<?php 
require_once "connexion.php";
require_once "Model/devisModel.php";
require_once "Model/factureModel.php";
//Appel au singleton Connexion
$maConnexion = ConnexionSingleton::getInstance();
$maConnexion->Connect();
?>
<div class="div_devis_accueil">
	<?php 
		$devis = new devisModel();
		$tab_devis = $devis->getDevis(5);
		echo "<table class='tabDevis' width='100%'>";
		echo "<tr class='fond_tr'><td colspan='5' style='color:#404146;'> Les 5 derniers devis </td></tr>";
		echo "<tr style='color:#488BD2;background:#fff;'><td class='tab_td_style'> ID</td><td class='tab_td_style'> Montant </td><td class='tab_td_style'> Date</td><td class='tab_td_style'> Client</td><td class='tab_td_style'> Utilisateur</td></tr>";
		foreach($tab_devis as $key => $value)
		{
			echo "<tr id='".$value['id']."' style='background:#fff;'>";
				echo "<td class='tab_td_style'>".$value["id"]."</td>";
				echo "<td class='tab_td_style'>".$value["montant"]."</td>";
				echo "<td class='tab_td_style'>".$value["date"]."</td>";
				echo "<td class='tab_td_style'>".$value["client"]."</td>";
				echo "<td class='tab_td_style'>".$value["utilisateur"]."</td>";
				echo "</tr>";	
		}
		echo "</table>";
		
	?>
</div>
<div class="div_facture_accueil">
	<?php 
		$facture = new factureModel();
		$tab_facture = $facture->getFacture(5);
		echo "<table class='tabDevis' width='100%'>";
		echo "<tr class='fond_tr'><td colspan='6' style='color:#404146;'> Les 5 derniere facture </td></tr>";
		echo "<tr style='color:#488BD2;background:#fff;'><td class='tab_td_style'> ID</td><td class='tab_td_style'> Montant </td><td class='tab_td_style'> Date Facture</td><td class='tab_td_style'> Client</td><td class='tab_td_style'> Utilisateur </td><td class='tab_td_style'>Date devis</td></tr>";
		foreach($tab_facture as $key => $value)
		{
				echo "<tr id='".$value['id']."' style='background:#fff;'>";
				echo "<td class='tab_td_style'>".$value["id"]."</td>";
				echo "<td class='tab_td_style'>".$value["montant"]."</td>";
				echo "<td class='tab_td_style'>".$value["dateFacture"]."</td>";
				echo "<td class='tab_td_style'>".$value["client"]."</td>";
				echo "<td class='tab_td_style'>".$value["utilisateur"]."</td>";
				echo "<td class='tab_td_style'>".$value["dateDevis"]."</td>";
				echo "</tr>";	
		}
		echo "</table>";
	?>
</div>